package request

import (
        "topsdk/util"
    )

type TaobaoMiniappTemplateInstantiateRequest struct {
    /*
        投放端,目前可投放： taobao(淘宝),tmall(天猫)，taobao为必填，需要模板在这些端上已经发布上线     */
    Clients  *[]string `json:"clients" required:"true" `
    /*
        描述长度(9~200)     */
    Description  *string `json:"description" required:"true" `
    /*
        扩展信息，JSON格式。     */
    ExtJson  *string `json:"ext_json" required:"true" `
    /*
        小程序icon     */
    Icon  *string `json:"icon" required:"true" `
    /*
        小程序名称按平台规则自动生成，该字段仅做兜底使用。     */
    Name  *string `json:"name,omitempty" required:"false" `
    /*
        模板id     */
    TemplateId  *string `json:"template_id" required:"true" `
    /*
        模板版本     */
    TemplateVersion  *string `json:"template_version" required:"true" `
    /*
        小程序简称【1-16】字符，可重名     */
    Alias  *string `json:"alias,omitempty" required:"false" `
}

func (s *TaobaoMiniappTemplateInstantiateRequest) SetClients(v []string) *TaobaoMiniappTemplateInstantiateRequest {
    s.Clients = &v
    return s
}
func (s *TaobaoMiniappTemplateInstantiateRequest) SetDescription(v string) *TaobaoMiniappTemplateInstantiateRequest {
    s.Description = &v
    return s
}
func (s *TaobaoMiniappTemplateInstantiateRequest) SetExtJson(v string) *TaobaoMiniappTemplateInstantiateRequest {
    s.ExtJson = &v
    return s
}
func (s *TaobaoMiniappTemplateInstantiateRequest) SetIcon(v string) *TaobaoMiniappTemplateInstantiateRequest {
    s.Icon = &v
    return s
}
func (s *TaobaoMiniappTemplateInstantiateRequest) SetName(v string) *TaobaoMiniappTemplateInstantiateRequest {
    s.Name = &v
    return s
}
func (s *TaobaoMiniappTemplateInstantiateRequest) SetTemplateId(v string) *TaobaoMiniappTemplateInstantiateRequest {
    s.TemplateId = &v
    return s
}
func (s *TaobaoMiniappTemplateInstantiateRequest) SetTemplateVersion(v string) *TaobaoMiniappTemplateInstantiateRequest {
    s.TemplateVersion = &v
    return s
}
func (s *TaobaoMiniappTemplateInstantiateRequest) SetAlias(v string) *TaobaoMiniappTemplateInstantiateRequest {
    s.Alias = &v
    return s
}

func (req *TaobaoMiniappTemplateInstantiateRequest) ToMap() map[string]interface{} {
    paramMap := make(map[string]interface{})
    if(req.Clients != nil) {
        paramMap["clients"] = util.ConvertBasicList(*req.Clients)
    }
    if(req.Description != nil) {
        paramMap["description"] = *req.Description
    }
    if(req.ExtJson != nil) {
        paramMap["ext_json"] = *req.ExtJson
    }
    if(req.Icon != nil) {
        paramMap["icon"] = *req.Icon
    }
    if(req.Name != nil) {
        paramMap["name"] = *req.Name
    }
    if(req.TemplateId != nil) {
        paramMap["template_id"] = *req.TemplateId
    }
    if(req.TemplateVersion != nil) {
        paramMap["template_version"] = *req.TemplateVersion
    }
    if(req.Alias != nil) {
        paramMap["alias"] = *req.Alias
    }
    return paramMap
}

func (req *TaobaoMiniappTemplateInstantiateRequest) ToFileMap() map[string]interface{} {
    fileMap := make(map[string]interface{})
    return fileMap
}